StepperULN2003
Loading...
Searching...
No Matches
StepperULN2003.h File Reference

Control 28BYJ-48 stepper motor via ULN2003 driver. More...

Go to the source code of this file.

Classes

class  Stepper
 Controls a 28BYJ-48 stepper motor via ULN2003 driver IC. More...
 

Macros

#define FULL   Stepper::FULL8
 
#define HALF   Stepper::HALF4
 

Detailed Description

Control 28BYJ-48 stepper motor via ULN2003 driver.

Supports full-step (8) and half-step (4) modes. Default is half-step. Typical full rotation: 4096 steps (adjust for gear ratio).

/**
* StepperMotorSimple
*
* A simple stepper motor example to show how to use this library.
*/
#include <StepperULN2003.h>
#define STEPPER_STEPS 4096
#define STEPPER_SPEED 10
#define DELAY_PERIOD 1000
// create an instance of the stepper class, specifying the number of steps of
// the motor and the pins it's attached to
Stepper stepper(STEPPER_STEPS, 2, 3, 4, 5);
void setup() {
// Set the speed of the motor to 10 RPMs
stepper.setSpeed(STEPPER_SPEED);
// Set the step mode to use the 8-step mode
stepper.setStepMode(FULL);
}
void loop() {
// Perform a full revolution clockwise
stepper.step(STEPPER_STEPS);
delay(DELAY_PERIOD);
// Perform a full revolution counter-clockwise
stepper.step(-STEPPER_STEPS);
delay(DELAY_PERIOD);
}
Control 28BYJ-48 stepper motor via ULN2003 driver.
Controls a 28BYJ-48 stepper motor via ULN2003 driver IC.
Definition StepperULN2003.h:28

See README for wiring and step sequence details.

Author
Philippe Gabriel